﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using VK.Comm;

namespace VK.Casemeet.Lines
{
    public static class LineHelper
    {
        #region 活动类型
        public static ListItem[] TypeData = new ListItem[15]{
            new ListItem("观光旅游", "1"),
            new ListItem("摄影", "2"),
            new ListItem("徒步", "3"),
            new ListItem("登山", "4"),
            new ListItem("自驾车", "5"),
            new ListItem("越野", "6"),
            new ListItem("摩托车", "7"),
            new ListItem("山地骑行", "8"),
            new ListItem("公路骑行", "9"),
            new ListItem("跑步", "10"),
            new ListItem("滑雪", "11"),
            new ListItem("航海", "12"),
            new ListItem("滑翔伞", "13"),
            new ListItem("寻宝", "14"),
            new ListItem("其他", "15")
        };

        public static void BindTypeDDL(DropDownList control, OptionType optionType)
        {
            control.Items.Clear();
            control.Items.AddRange(TypeData);
            switch (optionType)
            {
                case OptionType.Default: break;
                case OptionType.Search: control.Items.Insert(0, new ListItem("全部", "0")); break;
                case OptionType.Select: control.Items.Insert(0, new ListItem("请选择", "0")); break;
            }
            control.SelectedIndex = 0;
        }

        public static string GetTypeLabel(int type)
        {
            string result = string.Empty;
            var items = TypeData.Where(p => p.Value == type.ToString());
            if (items.Count() > 0)
            {
                result = items.First().Text;
            }
            return result;
        }
        #endregion

        #region 节日
        public static ListItem[] HolidayData = new ListItem[8]{
            new ListItem("元旦", "1"),
            new ListItem("春节", "2"),
            new ListItem("清明", "3"),
            new ListItem("五一", "4"),
            new ListItem("端午", "5"),
            new ListItem("中秋", "6"),
            new ListItem("国庆", "7"),
            new ListItem("其它", "8")
        };

        public static void BindHolidayDDL(DropDownList control, OptionType optionType)
        {
            control.Items.Clear();
            control.Items.AddRange(HolidayData);
            switch (optionType)
            {
                case OptionType.Default: break;
                case OptionType.Search: control.Items.Insert(0, new ListItem("全部", "0")); break;
                case OptionType.Select: control.Items.Insert(0, new ListItem("请选择", "0")); break;
            }
            control.SelectedIndex = 0;
        }

        public static string GetHolidayLabel(int holiday)
        {
            string result = string.Empty;
            var items = HolidayData.Where(p => p.Value == holiday.ToString());
            if (items.Count() > 0)
            {
                result = items.First().Text;
            }
            return result;
        }
        #endregion

        #region 住宿方式
        public static ListItem[] StayData = new ListItem[11]{
            new ListItem("露营为主", "1"),
            new ListItem("农家", "2"),
            new ListItem("青年旅社", "3"),
            new ListItem("旅店/客栈", "4"),
            new ListItem("农家乐", "5"),
            new ListItem("家庭旅馆", "6"),
            new ListItem("经济型宾馆", "7"),
            new ListItem("三星级宾馆", "8"),
            new ListItem("四星级宾馆", "9"),
            new ListItem("五星及以上宾馆", "10"),
            new ListItem("高中低档混合", "11")
        };

        public static void BindStayDDL(DropDownList control, OptionType optionType)
        {
            control.Items.Clear();
            control.Items.AddRange(StayData);
            switch (optionType)
            {
                case OptionType.Default: break;
                case OptionType.Search: control.Items.Insert(0, new ListItem("全部", "0")); break;
                case OptionType.Select: control.Items.Insert(0, new ListItem("请选择", "0")); break;
            }
            control.SelectedIndex = 0;
        }

        public static string GetStayLabel(int stay)
        {
            string result = string.Empty;
            var items = StayData.Where(p => p.Value == stay.ToString());
            if (items.Count() > 0)
            {
                result = items.First().Text;
            }
            return result;
        }
        #endregion

        #region 活动分级
        public static ListItem[] GradeData = new ListItem[8]{
            new ListItem("休闲级/旅行", "1"),
            new ListItem("低强度/低危险", "2"),
            new ListItem("中强度/低危险", "3"),
            new ListItem("中强度/中度危险", "4"),
            new ListItem("高强度/低危险", "5"),
            new ListItem("高强度/中度危险", "6"),
            new ListItem("极高强度/中度危险", "7"),
            new ListItem("极高强度/高度危险", "8")
        };

        public static void BindGradeDDL(DropDownList control, OptionType optionType)
        {
            control.Items.Clear();
            control.Items.AddRange(GradeData);
            switch (optionType)
            {
                case OptionType.Default: break;
                case OptionType.Search: control.Items.Insert(0, new ListItem("全部", "0")); break;
                case OptionType.Select: control.Items.Insert(0, new ListItem("请选择", "0")); break;
            }
            control.SelectedIndex = 0;
        }

        public static string GetGradeLabel(int grade)
        {
            string result = string.Empty;
            var items = GradeData.Where(p => p.Value == grade.ToString());
            if (items.Count() > 0)
            {
                result = items.First().Text;
            }
            return result;
        }
        #endregion

        #region 活动时长
        public static ListItem[] DayData = new ListItem[8]{
            new ListItem("1天", "1-1"),
            new ListItem("2天", "2-2"),
            new ListItem("3天", "3-3"),
            new ListItem("4天", "4-4"),
            new ListItem("5-7天", "5-7"),
            new ListItem("8-12天", "6-12"),
            new ListItem("13-20天", "13-20"),
            new ListItem("20天以上", "20-0")
        };
        #endregion

        #region 出行月份
        public static ListItem[] MonData = new ListItem[12]{
            new ListItem("1月", "1"),
            new ListItem("2月", "2"),
            new ListItem("3月", "3"),
            new ListItem("4月", "3"),
            new ListItem("5月", "5"),
            new ListItem("6月", "6"),
            new ListItem("7月", "7"),
            new ListItem("8月", "8"),
            new ListItem("9月", "9"),
            new ListItem("10月", "10"),
            new ListItem("11月", "11"),
            new ListItem("12月", "12")
        };
        #endregion

        #region 活动预算
        public static ListItem[] PriceData = new ListItem[8]{
            new ListItem("0-199", "0-199"),
            new ListItem("200-499", "200-499"),
            new ListItem("500-999", "500-999"),
            new ListItem("1000-1999", "1000-1999"),
            new ListItem("2000-4999", "2000-4999"),
            new ListItem("5000-9999", "5000-9999"),
            new ListItem("10000-19999", "10000-19999"),
            new ListItem("20000以上", "20000-0")
        };
        #endregion

        public static string FormatDepartureDate(DateTime datetime)
        {
            string result = "已过期";
            if (datetime != Util.DateTimeNull)
            {
                result = datetime.ToString("yyyy-MM-dd");

            }
            return result;
        }
    }
}
